/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author msc
 */
@Entity
@Table(name = "TypeOfTransaction")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TypeOfTransaction.findAll", query = "SELECT t FROM TypeOfTransaction t"),
    @NamedQuery(name = "TypeOfTransaction.findByTransactionTypeId", query = "SELECT t FROM TypeOfTransaction t WHERE t.transactionTypeId = :transactionTypeId"),
    @NamedQuery(name = "TypeOfTransaction.findByTransactionTypeName", query = "SELECT t FROM TypeOfTransaction t WHERE t.transactionTypeName = :transactionTypeName")})
public class TypeOfTransaction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "TransactionTypeId")
    private Integer transactionTypeId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 63)
    @Column(name = "TransactionTypeName")
    private String transactionTypeName;
    @OneToMany(mappedBy = "transactionTypeId")
    private Collection<TransactionRecord> transactionRecordCollection;

    public TypeOfTransaction() {
    }

    public TypeOfTransaction(Integer transactionTypeId) {
        this.transactionTypeId = transactionTypeId;
    }

    public TypeOfTransaction(Integer transactionTypeId, String transactionTypeName) {
        this.transactionTypeId = transactionTypeId;
        this.transactionTypeName = transactionTypeName;
    }

    public Integer getTransactionTypeId() {
        return transactionTypeId;
    }

    public void setTransactionTypeId(Integer transactionTypeId) {
        this.transactionTypeId = transactionTypeId;
    }

    public String getTransactionTypeName() {
        return transactionTypeName;
    }

    public void setTransactionTypeName(String transactionTypeName) {
        this.transactionTypeName = transactionTypeName;
    }

    @XmlTransient
    public Collection<TransactionRecord> getTransactionRecordCollection() {
        return transactionRecordCollection;
    }

    public void setTransactionRecordCollection(Collection<TransactionRecord> transactionRecordCollection) {
        this.transactionRecordCollection = transactionRecordCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transactionTypeId != null ? transactionTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeOfTransaction)) {
            return false;
        }
        TypeOfTransaction other = (TypeOfTransaction) object;
        if ((this.transactionTypeId == null && other.transactionTypeId != null) || (this.transactionTypeId != null && !this.transactionTypeId.equals(other.transactionTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.entities.TypeOfTransaction[ transactionTypeId=" + transactionTypeId + " ]";
    }
    
}
